Repository navigation
[Performance] Move Search and submit-expense onto write-readiness barriers and delete deferredLayoutWrite - #100169
Conversation
…s and delete deferredLayoutWrite
|
@claude review |
|
@codex review |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 429ce349fd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@MelvinBot review |
🤖 Code reviewThe cutover itself looks correct. I traced every path that used to reserve a Nothing blocking. Two things I'd want answered before merge (2 and 3), plus stale-comment cleanup. 1. Dangling identifier in a comment
Same for "write session", which isn't a concept in the codebase, at 2.
|
Please re-review |
🤖 Re-review — all clearVerified every item against 1. Comments — ✅ Fixed. 2. Worth noting No test asserts notify ordering on these paths — the only behavioral assertion is in 3. READ gate — ✅ Confirmed, withdrawing the concern. #99815 added the gate specifically because 4. Test comments — ✅ All eight removed. 5. Minor — ✅ Only thing outstanding is the one you already called: Next Steps: Reply with |
# Conflicts: # src/libs/actions/IOU/Split.ts # src/libs/actions/IOU/TrackExpense.ts
deferredLayoutWritedeferredLayoutWrite
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 885290ae4d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
The This is probably low impact because the signals are short-lived, but using |
|
Potential edge case: The combination of |
|
Potential regression from the previous deferred-write behavior: this now checks specifically for The previous flow appears to distinguish the app being inactive/not active from fully backgrounded. If |
|
@brunovjk thank you for the reivew, @JakubKorytko is coming back and since he's got better understanding of this PR it think it's better that we'll wait for him to address the comments 😄 |
|
@brunovjk thanks for the thorough review. It would be better if it were a code review rather than plain comments, as it would be easier to answer and find in the code 😅 let me summarise: Addressed
No change, by design
|
Sorry about that. I will review it in a moment. Thanks |
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp100169_android_web.movAndroid: mWeb Chrome100169_android_web.moviOS: HybridAppiOS: mWeb Safari100169_ios_web.movMacOS: Chrome / Safari100169_web_chrome.mov |
|
will review within the next ~24hrs. In the meantime, there are conflicts here |
Julesssss
left a comment
There was a problem hiding this comment.
When creating IOUs via writeWhenReady they now only flush when a background event occurs. Previously they also flushed on inactive. Is there a case where the app is killed without the background lifecycle step has happened? For example, app is killed by user in app switcher (I'm not sure if app switcher triggers the iOS background lifecycle event or not)
| */ | ||
| function resolveWatchKey(tracking: TrackingMutableState, setOptimisticWatchKey: React.Dispatch<React.SetStateAction<OnyxKey | undefined>>): (() => void) | undefined { | ||
| const latestKey = getOptimisticWatchKey(CONST.DEFERRED_LAYOUT_WRITE_KEYS.SEARCH); | ||
| const latestKey = getSearchWriteWatchKey(); |
There was a problem hiding this comment.
Resolves the optimistic watch key from the deferred write channel and
Function docs could be updated
There was a problem hiding this comment.
valid, updated to:
Looks up the Onyx key of the optimistic item created by the pending Search write and
roryabraham
left a comment
There was a problem hiding this comment.
huge diff, but nothing jumped out at me. LGTM 👍🏼
|
🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/roryabraham in version: 9.4.94-0 🚀
|
|
No help site changes are required for [Performance] Move Search and submit-expense onto write-readiness barriers and delete This PR changes only when optimistic data is written after you submit an expense. It does not change any feature, setting, button, label, or user flow that What I checked
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.4.94-0 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Submitting an expense from a report, Search or global create used to defer its API write through the deferredLayoutWrite "channel" system, so the optimistic data would land only after the screen transition finished. That system was implicit: the write had to guess which channel would be flushed, and any screen that forgot to flush left writes stuck.
This PR switches every submit path (request money, track expense, split, send money, invoice, per diem) and Search over to the explicit write-readiness barriers that already landed on main. The submit orchestrator arms one barrier for the transition and hands it to the action it calls, so each write knows exactly what it waits for. Search owns its own barrier and releases it once its layout is ready, on focus, on a timeout fallback, or when the app goes to background. A small pending-write signal replaces the old report-side flag that drove the loading skeleton and empty-state animation.
With all callers moved, the old channel system (deferredLayoutWrite, the global-create Search reservation helper, the flush-on-focus hook, and the related CONST keys) is unreferenced, so it is deleted in the same PR. Keeping replacement and removal together avoids leaving ~700 lines of dead code on main between two PRs. No new modules are added here: the change is rewiring plus deletion.
Fixed Issues
$ #96010
PROPOSAL: N/A
Tests
T1. Inbox dismiss-only
T2. Inbox open report
T3. Search skeleton
T4. Search bulk split
T5. Other expense types (Inbox, Workspace A expenses chat)
T6. Split and pay (DM with another user)
T7. Send invoice
T8. Read during deferral
T9. Background (native only)
T10. Quick action scan (workspace without required categories)
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS_gh.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari
Web.mp4